package com.job.ZhangMeng.Homework0712;

//工厂模式
public class AttackMethods {
    public static Tiger chooseMethod(int ch){
        if(ch==1){
            return new OldTiger("老年虎","威武",18);
        }
        else if(ch==2){
            return new AdultTiger("青年虎","霸气",9);
        }
        else if(ch==3){
            return new SmallTiger("幼年虎","销户",1);
        }
        else
        {
            Tiger ac=new Tiger(){
                public void attack()
                {
                    System.out.println("null!");
                }
            };
            return ac;
        }
    }
}
